-
Couldn't load subscription status.
- Fork 13
Add HMAC capabilities #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HMAC capabilities #181
Conversation
1ecb907 to
67fc1d5
Compare
67fc1d5 to
55519b0
Compare
114af31 to
e7ffe2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds HMAC signing capabilities to the Reporting client.
- Introduces a new parameter "sign_secret" in ReportingApiClient and updates its initialization.
- Adds a new CLI option "--sign_secret" to enable HMAC support via the command line.
- Updates tests and dependency versions to support the new HMAC functionality.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_client_reporting.py | Adds "sign_secret" test parameter and verifies its propagation to the base class. |
| src/frequenz/client/reporting/cli/main.py | Introduces the CLI option "--sign_secret" for HMAC signing. |
| src/frequenz/client/reporting/_client.py | Updates ReportingApiClient to accept and pass "sign_secret" to BaseApiClient. |
| pyproject.toml | Updates dependency version of frequenz-client-base. |
| RELEASE_NOTES.md | Adds new release note entries for the HMAC generation capabilities. |
Comments suppressed due to low confidence (1)
RELEASE_NOTES.md:13
- The release notes currently reference the 'key' argument for HMAC functionality; please update them to correctly mention the new '--sign_secret' CLI option and the 'sign_secret' parameter used for HMAC signing.
* Add HMAC generation capabilities.
| class ReportingApiClient(BaseApiClient[ReportingStub]): | ||
| """A client for the Reporting service.""" | ||
|
|
||
| # pylint: disable=too-many-arguments, too-many-positional-arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use disable= in its own line, that will disable the check for the rest of the file, not only for the next line, if you want to disable it only for the next line you need to use disable-next=.
| # pylint: disable=too-many-arguments, too-many-positional-arguments | |
| # pylint: disable-next=too-many-arguments, too-many-positional-arguments |
Also I think in this case pylint has a point, and you should use positional-only arguments, specially for strings/bool that are really hard to read without a keyword on the call site.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, me being to meek about breaking the interface, but I am already doing it anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support two versions of protobuf-gencode. However, automated warnings treated as errors will prevent the package from building correctly with the newer version due to version mismatch. Signed-off-by: Florian Wagner <[email protected]>
e7ffe2f to
aadf204
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as the key rename is really not related to this PR, so it can be done in a separate PR.
This adds the capability for HMAC based signing into the reporting client. This also removes the need for ad-hoc api key management, as the underlying `BaseApiClient` will automatically create an interceptor to inject the key as metadata. Signed-off-by: Florian Wagner <[email protected]>
aadf204 to
d745b39
Compare
| server_url: str, | ||
| key: str | None = None, | ||
| *, | ||
| auth_key: str | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please update the README w.r.t. these interface changes.

This adds the capability for HMAC based signing into the reporting client.